package com.cj.controller;

import com.cj.po.PageInfo;
import com.cj.po.Student;
import com.cj.service.ClassStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class ClassStudentController {
    @Autowired
    private ClassStudentService classStudentService;
    /**
     * 分页查询
     * pageIndex 当前页码
     * pageSize  显示条数
     */
    @RequestMapping(value = "/findClassStudent")
    public String findClassStudent(String s_name, Integer s_studentid,Integer classId, String className,String counsellor,String s_phone,Integer s_dormitoryid,
                                   Integer pageIndex, Integer pageSize, Model model) {

        PageInfo<Class> pi = classStudentService.findPageInfo(classId,className,counsellor,s_studentid,s_name,s_phone,s_dormitoryid,
                pageIndex,pageSize);
        model.addAttribute("pi",pi);
        model.addAttribute("s_name",s_name);
        System.out.println("111");
        return "classstudentlist";
    }


    /**
     * 导出Excel
     */
    @RequestMapping(value = "/exportclassstudentlist", method = RequestMethod.POST)
    @ResponseBody
    public List<Class> exportClassStu(){
        List<Class> classList = classStudentService.getAll2();
        return classList;
    }

}
